package cn.sylinx.horm.core.datasource;

import java.sql.Connection;

public class ConnectionInfo {

    private Connection connection;
    private String datasourceName;

    public Connection getConnection() {
        return connection;
    }

    public ConnectionInfo setConnection(Connection connection) {
        this.connection = connection;
        return this;
    }

    public String getDatasourceName() {
        return datasourceName;
    }

    public ConnectionInfo setDatasourceName(String datasourceName) {
        this.datasourceName = datasourceName;
        return this;
    }

    public static ConnectionInfo apply(String datasourceName, Connection connection) {
        return new ConnectionInfo().setDatasourceName(datasourceName).setConnection(connection);
    }
}
